package com.boxin.ims.modules.wechat.entity;

import java.util.Date;

import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.Table;
import javax.persistence.Transient;
import javax.validation.constraints.NotNull;

import org.hibernate.annotations.Cache;
import org.hibernate.annotations.CacheConcurrencyStrategy;
import org.hibernate.annotations.NotFound;
import org.hibernate.annotations.NotFoundAction;
import org.hibernate.validator.constraints.Length;

import com.thinkgem.jeesite.common.persistence.BaseEntity;
import com.thinkgem.jeesite.modules.sys.entity.User;


/**
 * 带场景值得二维码
 * @author xiaoqian
 *
*	2014下午5:17:19
 */
@Entity
@Table(name = "wp_wechat_scene")
@Cache(usage = CacheConcurrencyStrategy.READ_WRITE)
public class WechatScene extends BaseEntity {
	
	public final static  String SCENE_TYPE_MEMBER = "0";
	
	public final static String  SCENE_PRE_FIX = "qrscene_";
	
	//三级推广临时二维码
		public final static String SCENE_TYPE_RECOMMEND_TEMP = "6";

	/**
	 * 
	 */
	private static final long serialVersionUID = 1L;
	private Long id; 				// 编号
	private User user; 				// 用户
	private Long sceneId;		//场景值
	private String scene;			//场景值对应的场景
	private String	 ticket;			//二维码换取凭证
	private String type;				//渠道类型		0：会员推广     1:添加传图设计师  2：添加财务
	private Integer expireSeconds;//临时二维码时间
	private	String qrcodeType;	//QR_LIMIT_SCENE永久	QR_SCENE 临时
	private String delFlag;			//删除标记（0：正常；1：删除）
	private String processorId;		//对应业务处理器ID
	
	private 	Date createTime;			//创建时间
	private Date updateTime;		//更新时间
	
	private Long bindId;			//绑定的业务ID
	private String paramMapJson;//json 参数
	private String keyword;		//回复关键词
	
	
	public WechatScene() {
		this.createTime = new Date();
		this.updateTime = new Date();
		this.delFlag = DEL_FLAG_NORMAL;
	}
	
	
	public WechatScene(Long id){
		this();
		this.id = id;
	}
	
	
	@Id
	@GeneratedValue(strategy = GenerationType.IDENTITY)
	//@GeneratedValue(strategy = GenerationType.SEQUENCE, generator = "seq_wechat_wechatMember")
	//@SequenceGenerator(name = "seq_wechat_wechatMember", sequenceName = "seq_wechat_wechatMember")
	public Long getId() {
		return id;
	}

	public void setId(Long id) {
		this.id = id;
	}

	@ManyToOne
	@JoinColumn(name="user_id")
	@NotFound(action = NotFoundAction.IGNORE)
	@Cache(usage = CacheConcurrencyStrategy.READ_WRITE)
	@NotNull
	public User getUser() {
		return user;
	}

	public void setUser(User user) {
		this.user = user;
	}


	public Long getSceneId() {
		return sceneId;
	}


	public void setSceneId(Long sceneId) {
		this.sceneId = sceneId;
	}

	@Length(min=1, max=100)
	public String getScene() {
		return scene;
	}


	public void setScene(String scene) {
		this.scene = scene;
	}


	public Integer getExpireSeconds() {
		return expireSeconds;
	}


	public void setExpireSeconds(Integer expireSeconds) {
		this.expireSeconds = expireSeconds;
	}
	
	

	public String getQrcodeType() {
		return qrcodeType;
	}


	public void setQrcodeType(String qrcodeType) {
		this.qrcodeType = qrcodeType;
	}


	@Length(min=1, max=1)
	public String getDelFlag() {
		return delFlag;
	}


	public void setDelFlag(String delFlag) {
		this.delFlag = delFlag;
	}


	public Date getCreateTime() {
		return createTime;
	}


	public void setCreateTime(Date createTime) {
		this.createTime = createTime;
	}


	public Date getUpdateTime() {
		return updateTime;
	}


	public void setUpdateTime(Date updateTime) {
		this.updateTime = updateTime;
	}


	public String getTicket() {
		return ticket;
	}


	public void setTicket(String ticket) {
		this.ticket = ticket;
	}


	public String getProcessorId() {
		return processorId;
	}


	public void setProcessorId(String processorId) {
		this.processorId = processorId;
	}


	public String getType() {
		return type;
	}


	public void setType(String type) {
		this.type = type;
	}


	public Long getBindId() {
		return bindId;
	}


	public void setBindId(Long bindId) {
		this.bindId = bindId;
	}


	public String getParamMapJson() {
		return paramMapJson;
	}


	public void setParamMapJson(String paramMapJson) {
		this.paramMapJson = paramMapJson;
	}


	public String getKeyword() {
		return keyword;
	}


	public void setKeyword(String keyword) {
		this.keyword = keyword;
	}

	
}
